const plusPriceTypeData = [
  {
    key:1,
    float:"left",
  },{
    key:2,
    float:"right",
  },{
    key:3,
    float:"left",
  },{
    key:4,
    float:"right",
  },{
    key:5,
    float:"left",
  },{
    key:6,
    float:"right",
  }
];
const vipPriceTypeData = [
  {
    key:1,
    type:"chinese",
    float:"left",
    icon:""
  },
  {
    key:2,
    type:"chinese",
    float:"right",
    icon:""
  },{
    key:3,
    type:"english",
    float:"left",
    icon:""
  },{
    key:4,
    type:"english",
    float:"right",
    icon:""
  },
];
const buyBtnConfigData = [
	
    {
        key: 1,
        type: 'primary',
        round: '0',
        icon: ''
    },
    {
        key: 2,
        type: 'plain',
        round: '0',
        icon: ''
    },
    {
        key: 3,
        type: '',
        round: '0',
        icon: ''
    },
    {
        key: 4,
        type: 'primary',
        round: '4',
        icon: ''
    },
    {
        key: 5,
        type: 'plain',
        round: '4',
        icon: ''
    },
    {
        key: 6,
        type: '',
        round: '4',
        icon: ''
    },
    {
        key: 7,
        type: 'primary',
        round: '50',
        icon: ''
    },
    {
        key: 8,
        type: 'plain',
        round: '50',
        icon: ''
    },
    {
        key: 9,
        type: '',
        round: '50',
        icon: ''
    }, // 图标
    {
        key: 10,
        type: '',
        round: '',
        icon: 'iconziyuan133'
    },
    {
        key: 11,
        type: '',
        round: '',
        icon: 'iconziyuan132'
    },
    {
        key: 12,
        type: '',
        round: '',
        icon: 'iconziyuan149'
    },
    {
        key: 13,
        type: '',
        round: '',
        icon: 'iconziyuan134'
    },
    {
        key: 14,
        type: '',
        round: '',
        icon: 'iconziyuan136'
    },
    {
        key: 15,
        type: '',
        round: '',
        icon: 'iconziyuan137'
    }
];

function tintColor(color, tint) {
    let red = parseInt(color.slice(0, 2), 16);
    let green = parseInt(color.slice(2, 4), 16);
    let blue = parseInt(color.slice(4, 6), 16);

    if (tint === 0) {
        // when primary color is in its rgb space
        return [red, green, blue].join(',');
    } else {
        red += Math.round(tint * (255 - red));
        green += Math.round(tint * (255 - green));
        blue += Math.round(tint * (255 - blue));
        red = red.toString(16);
        green = green.toString(16);
        blue = blue.toString(16);
        return `#${red}${green}${blue}`;
    }
}

function shadeColor(color, shade) {
    let red = parseInt(color.slice(0, 2), 16);
    let green = parseInt(color.slice(2, 4), 16);
    let blue = parseInt(color.slice(4, 6), 16);
    red = Math.round((1 - shade) * red);
    green = Math.round((1 - shade) * green);
    blue = Math.round((1 - shade) * blue);
    red = red.toString(16);
    green = green.toString(16);
    blue = blue.toString(16);
    return `#${red}${green}${blue}`;
}
/**
 * 16 进制 颜色 转 各透明度 的色值
 * 计算公式来源于 element-ui 主题设置
 * @param {*} theme
 * @returns
 */

function getThemeCluster(theme) {
    theme = theme.replace('#', '');
    const clusters = [theme];

    for (let i = 0; i <= 9; i++) {
        clusters.push(tintColor(theme, Number((i / 10).toFixed(2))));
    }

    clusters.push(shadeColor(theme, 0.1));
    return clusters;
}

export { buyBtnConfigData, getThemeCluster,vipPriceTypeData,plusPriceTypeData};
